﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

namespace ChinaCustoms.Qingdao.Workflow.Supports
{
    [DataContract]
    public class WorkflowTemplateQuery
    {
        [DataMember]
        public int WorkflowTemplateID = 0;
        [DataMember]
        public string WorkflowTemplateName= string.Empty;
        [DataMember]
        public Guid ApplicationID = Guid.Empty;
        [DataMember]
        public string ApplicationName = string.Empty;
        [DataMember]
        public Guid FunctionID = Guid.Empty;
        [DataMember]
        public string FunctionName= string.Empty;
        [DataMember]
        public Guid CreateUserID= Guid.Empty;
        [DataMember]
        public string CreateUserName= string.Empty;
        [DataMember]
        public bool IsDelete= false;
        [DataMember]
        public bool IsPublic= true;

        [DataMember]
        public int PageIndex = 0;
        [DataMember]
        public int PageSize = 20;
        [DataMember]
        public bool IgnorePaging = false;
        [DataMember]
        public int MaxRecords = -1;
        [DataMember]
        public string CacheKey
        {
            get
            {
                return string.Format("WorkflowTemplate::WorkflowTemplateID:{0}-WorkflowTemplateName:{1}-ApplicationID:{2}-PI:{3}-PS:{4}-IP:{5}"+
                    "-ApplicationName:{6}-FunctionID:{7}-FunctionName:{8}-CreateUserID:{9}-CreateUserName:{10}-IsDelete:{11}-IsPublic:{12}",
                    WorkflowTemplateID, WorkflowTemplateName, ApplicationID.ToString(), PageIndex, PageSize, IgnorePaging, ApplicationName, FunctionID.ToString(),
                    FunctionName, CreateUserID.ToString(), CreateUserName, IsDelete.ToString(), IsPublic.ToString());
            }
            set
            { 
                //DoNothing;Only for WCF.
            }
        }
    }
}
